home *** CD-ROM | disk | FTP | other *** search
/ CICA 1993 April / CICA MS Windows - April 1993.iso / unzipped / programr / tp / ctl3dpas / sample3d.pas < prev   
Pascal/Delphi Source File  |  1993-02-24  |  3KB  |  97 lines

  1. (**************************************************)
  2. (*                                                *)
  3. (*   Sample3D - Shows the use of CTL3D.DLL        *)
  4. (*                                                *)
  5. (*   submitted by Andreas Furrer                  *)
  6. (*                                                *)
  7. (**************************************************)
  8.  
  9. program Sample3D;
  10.  
  11. {$R ctl3d.res}
  12.  
  13.  
  14. uses WinTypes, WinProcs, WObjects, CommDlg, Ctl3d;
  15.  
  16. type
  17.    Applikation =
  18.       object(TApplication)
  19.          procedure InitMainWindow; virtual;
  20.       end;
  21.  
  22.    PMainwindow = ^TMainwindow;
  23.    TMainwindow =
  24.       object(TDialog)
  25.          procedure WMSysColorChange(var Msg : TMessage); virtual wm_first + wm_SysColorChange;
  26.          procedure Msgbox(var Msg : TMessage);   virtual id_first + 130;
  27.          procedure Fileopen(var Msg : TMessage); virtual id_first + 131;
  28.       end;
  29.  
  30.  
  31.  
  32. procedure TMainwindow.WMSysColorChange;
  33. begin
  34.   Ctl3dColorChange;
  35. end;
  36.  
  37. procedure TMainwindow.Msgbox;
  38. begin
  39.   MessageBox(HWindow,'This is a sample Message Box','3D Look',mb_Ok);
  40. end;
  41.  
  42.  
  43. function HookProc(HWindow: HWnd; Msg, wParam: word; lParam: longint): word;far;
  44. var p : TFarProc;
  45. begin
  46.   IF Msg=wm_InitDialog then begin
  47.     Ctl3dSubClassDlg(HWindow,Ctl3d_All);
  48.   end;
  49.   HookProc:=0;
  50. end;
  51.  
  52. procedure TMainwindow.Fileopen;
  53. var FileName : array[0..255] of char;
  54.     Ofn :  TOpenFileName;
  55. begin
  56.   FileName[0]:=#0;
  57.   Ofn.lStructSize       := sizeof(TOpenFileName);
  58.   Ofn.hwndOwner         := HWindow;
  59.   Ofn.hInstance         := HInstance;
  60.   Ofn.lpstrFilter       :='Text Files (*.TXT)'+#0+'*.TXT'+#0+'All Files (*.*)'+#0+'*.*'+#0+#0;
  61.   Ofn.lpstrCustomFilter := nil;
  62.   Ofn.nMaxCustFilter    := 0;
  63.   Ofn.nFilterIndex      := 1;
  64.   Ofn.lpstrFile         := FileName;
  65.   Ofn.nMaxFile          := sizeof(FileName);
  66.   Ofn.lpstrFileTitle    := nil;
  67.   Ofn.nMaxFileTitle     := 0;
  68.   Ofn.lpstrInitialDir   := nil;
  69.   Ofn.lpstrTitle        := '3D Look';
  70.   Ofn.Flags             := ofn_HideReadonly or ofn_EnableHook;
  71.   Ofn.nFileOffset       := 0;
  72.   Ofn.nFileExtension    := 0;
  73.   Ofn.lpstrDefExt       := NIL;
  74.   Ofn.lpTemplateName    := 'FileOpen';
  75.   Ofn.lpfnHook:=HookProc;
  76.   Ofn.lCustData         := 0;
  77.  
  78.   GetOpenFileName(Ofn);
  79. end;
  80.  
  81. procedure Applikation.InitMainWindow;
  82. begin
  83.   MainWindow := New(PMainwindow, Init(nil, MakeIntResource(100)));
  84. end;
  85.  
  86. var Prg : Applikation;
  87.  
  88. begin
  89.    Ctl3dRegister(HInstance);
  90.    Ctl3dAutoSubclass(HInstance);
  91.  
  92.    Prg.Init('Sample3D');
  93.    Prg.Run;
  94.    Prg.Done;
  95.  
  96.    Ctl3dUnregister(HInstance);
  97. end.